<?php

/**
 * Post
 * 
 * 
 * @category   Model
 * @package    Post
 * @subpackage AppModel
 * @copyright  Copyright (c) 2012 Victor Rosset
 * @license    
 * @version    0.1 alpha
 * @link       http://www.tucho235.com.ar
 * @since      25-ago-2012
 * @author     Victor Rosset <victorrosset@gmail.com> @tucho235
 * @php        5.3.13
 * 
 */
 
class Post extends AppModel
{
    public $validate = array(
        'title' => array(
            'rule'    => 'notEmpty',
            'message' => 'Campo requerido'
        ),
        'body' => array(
            'rule'    => 'notEmpty',
            'message' => 'Campo requerido'
        )
    );
    
    public function isOwnedBy($post, $user) {
        return $this->field('id', array('id' => $post, 'user_id' => $user)) === $post;
    }
    

}